<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>游密科技 WebRTC SDK for HTML5</title>
    <link rel="stylesheet" href="./readme/github-markdown.css">
    <link rel="stylesheet" href="./readme/highlight.css">
    <style>
        .markdown-body {
            box-sizing: border-box;
            min-width: 200px;
            max-width: 980px;
            margin: 0 auto;
            padding: 45px;
        }
    
        @media (max-width: 767px) {
            .markdown-body {
                padding: 15px;
            }
        }
    </style>
</head>
<body>
    <article class="markdown-body">
        <h1><a id="user-content-游密科技-webrtc-sdk-for-html5" class="anchor" href="#游密科技-webrtc-sdk-for-html5" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>游密科技 WebRTC SDK for HTML5</h1>
<p>本 SDK 对 WebRTC 和游密信令服务器、游密 turn 服务器进行统一封装，开发者申请了游密 appKey 后，使用本 SDK 即可简单快速地实现实时视频和实时语音功能。</p>
<h2><a id="user-content-用法" class="anchor" href="#用法" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>用法</h2>
<p>使用本 SDK 只要四步。</p>
<h3><a id="user-content-第一步：引入-js-文件" class="anchor" href="#第一步：引入-js-文件" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>第一步：引入 js 文件</h3>
<p><strong>方法一：</strong> 直接引入 <code>ymrtc.bundle.min.js</code>：</p>
<div class="highlight"><pre class="editor editor-colors"><div class="line"><span class="text html"><span class="meta tag any html"><span class="punctuation definition tag html"><span>&lt;</span></span><span class="entity name tag html"><span>script</span></span><span> </span><span class="entity other attribute-name html"><span>src</span></span><span>=</span><span class="string quoted double html"><span class="punctuation definition string begin html"><span>&quot;</span></span><span>path/to/ymrtc.bundle.min.js</span><span class="punctuation definition string end html"><span>&quot;</span></span></span><span class="punctuation definition tag html"><span>&gt;</span><span class="meta scope html"><span>&lt;</span></span><span>/</span></span><span class="entity name tag html"><span>script</span></span><span class="punctuation definition tag html"><span>&gt;</span></span></span></span></div></pre></div>
<p><strong>方法二：</strong> 使用 npm ：</p>
<div class="highlight sh"><pre class="editor editor-colors"><div class="line"><span class="source shell"><span>$ npm install youme-webrtc --save</span></span></div></pre></div>
<h3><a id="user-content-第二步：初始化" class="anchor" href="#第二步：初始化" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>第二步：初始化</h3>
<p>本 SDK 只有一个类：<code>YMRTC</code>，只要实例化这个类，就可以使用本 SDK 的全部功能。</p>
<p>若使用<strong>方法一</strong>直接引入 js 文件，可以直接访问 <code>YMRTC</code> 类：</p>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="storage type js"><span>var</span></span><span> rtc </span><span class="keyword operator assignment js"><span>=</span></span><span> </span><span class="meta class instance constructor js"><span class="keyword operator js"><span>new</span></span><span> </span><span class="entity name type instance js"><span>YMRTC</span></span></span><span class="meta brace round js"><span>(</span></span><span class="meta brace curly js"><span>{</span></span></span></div><div class="line"><span class="source js"><span>    appKey</span><span class="keyword operator assignment js"><span>:</span></span><span> </span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[您所申请的 appKey 字符串]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span>    video</span><span class="keyword operator assignment js"><span>:</span></span><span> </span><span class="constant language boolean true js"><span>true</span></span><span>  </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> true 为视频+语音通讯，false 为仅语音通讯</span></span></span></div><div class="line"><span class="source js"><span class="meta brace curly js"><span>}</span></span><span class="meta brace round js"><span>)</span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p>本 SDK 同时支持 CommonJS 或 AMD 标准，除了上述直接引用，也可以使用这些标准方法初始化：</p>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> CommonJS 规范</span></span></span></div><div class="line"><span class="source js"><span class="storage type js"><span>var</span></span><span> </span><span class="constant other js"><span>YMRTC</span></span><span> </span><span class="keyword operator assignment js"><span>=</span></span><span> </span><span class="meta function-call js"><span class="support function js"><span>require</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>path/to/ymrtc.bundle.min.js</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div><div class="line"><span class="source js"><span class="storage type js"><span>var</span></span><span> rtc </span><span class="keyword operator assignment js"><span>=</span></span><span> </span><span class="meta class instance constructor js"><span class="keyword operator js"><span>new</span></span><span> </span><span class="entity name type instance js"><span>YMRTC</span></span></span><span class="meta brace round js"><span>(</span></span><span class="meta brace curly js"><span>{</span></span></span></div><div class="line"><span class="source js"><span>    appKey</span><span class="keyword operator assignment js"><span>:</span></span><span> </span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[您所申请的 appKey 字符串]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span>    video</span><span class="keyword operator assignment js"><span>:</span></span><span> </span><span class="constant language boolean true js"><span>true</span></span><span>  </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> true 为视频+语音通讯，false 为仅语音通讯</span></span></span></div><div class="line"><span class="source js"><span class="meta brace curly js"><span>}</span></span><span class="meta brace round js"><span>)</span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p>或者</p>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> AMD 规范</span></span></span></div><div class="line"><span class="source js"><span class="meta function-call js"><span class="support function js"><span>require</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="meta brace square js"><span>[</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>path/to/ymrtc.bundle.min.js</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta brace square js"><span>]</span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="meta function js"><span class="storage type function js"><span>function</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="constant other js"><span>YMRTC</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta function-call js"><span class="meta js"><span>    </span><span class="storage type js"><span>var</span></span><span> rtc </span><span class="keyword operator assignment js"><span>=</span></span><span> </span><span class="meta class instance constructor js"><span class="keyword operator js"><span>new</span></span><span> </span><span class="entity name type instance js"><span>YMRTC</span></span></span><span class="meta brace round js"><span>(</span></span><span class="meta brace curly js"><span>{</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta function-call js"><span class="meta js"><span>        appKey</span><span class="keyword operator assignment js"><span>:</span></span><span> </span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[您所申请的 appKey 字符串]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta function-call js"><span class="meta js"><span>        video</span><span class="keyword operator assignment js"><span>:</span></span><span> </span><span class="constant language boolean true js"><span>true</span></span><span>  </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> true 为视频+语音通讯，false 为仅语音通讯</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta function-call js"><span class="meta js"><span>    </span><span class="meta brace curly js"><span>}</span></span><span class="meta brace round js"><span>)</span></span><span class="punctuation terminator statement js"><span>;</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta function-call js"><span class="meta js"><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p>或者，若使用 ES6 或 TypeScript，可以使用 <code>import</code>：</p>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="meta import js"><span class="keyword control js"><span>import</span></span><span> </span><span class="variable other module js"><span>YMRTC</span></span><span> </span><span class="keyword control js"><span>from</span></span><span> </span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>path/to/ymrtc.bundle.min</span><span class="punctuation definition string end js"><span>'</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div><div class="line"><span class="source js"><span> </span></span></div><div class="line"><span class="source js"><span class="storage type js"><span>const</span></span><span> </span><span class="constant other js"><span>rtc</span></span><span> </span><span class="keyword operator assignment js"><span>=</span></span><span> </span><span class="meta class instance constructor js"><span class="keyword operator js"><span>new</span></span><span> </span><span class="entity name type instance js"><span>YMRTC</span></span></span><span class="meta brace round js"><span>(</span></span><span class="meta brace curly js"><span>{</span></span></span></div><div class="line"><span class="source js"><span>    appKey</span><span class="keyword operator assignment js"><span>:</span></span><span> </span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[您所申请的 appKey 字符串]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span>    video</span><span class="keyword operator assignment js"><span>:</span></span><span> </span><span class="constant language boolean true js"><span>true</span></span><span>  </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> true 为视频+语音通讯，false 为仅语音通讯</span></span></span></div><div class="line"><span class="source js"><span class="meta brace curly js"><span>}</span></span><span class="meta brace round js"><span>)</span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p>或者，若使用<strong>方法二</strong>使用 npm 引入，则使用本 SDK 的 npm 名称：</p>
<div class="highlight ts"><pre class="editor editor-colors"><div class="line"><span class="source"><span class="meta import"><span class="keyword control import"><span>import</span></span><span> </span><span class="variable other readwrite alias"><span>YMRTC</span></span><span> </span><span class="keyword control"><span>from</span></span><span> </span><span class="string quoted single"><span class="punctuation definition string begin"><span>'</span></span><span>youme-webrtc</span><span class="punctuation definition string end"><span>'</span></span></span></span><span class="punctuation terminator statement"><span>;</span></span></span></div><div class="line"><span class="source"><span> </span></span></div><div class="line"><span class="source"><span class="meta"><span class="storage type"><span>const</span></span><span> </span><span class="meta"><span class="meta definition variable variable other readwrite"><span>rtc</span></span><span> </span></span><span class="keyword operator assignment"><span>=</span></span><span> </span><span><span class="keyword operator"><span>new</span></span><span> </span><span class="entity name type"><span>YMRTC</span></span><span class="meta brace round"><span>(</span></span><span class="meta"><span class="punctuation definition block"><span>{</span></span></span></span></span></span></div><div class="line"><span class="source"><span class="meta"><span><span class="meta"><span>    </span><span class="meta object member"><span class="meta key"><span>appKey</span><span class="punctuation separator key-value"><span>:</span></span></span><span> </span><span class="string quoted single"><span class="punctuation definition string begin"><span>'</span></span><span>[您所申请的 appKey 字符串]</span><span class="punctuation definition string end"><span>'</span></span></span></span><span class="punctuation separator comma"><span>,</span></span></span></span></span></span></div><div class="line"><span class="source"><span class="meta"><span><span class="meta"><span>    </span><span class="meta object member"><span class="meta key"><span>video</span><span class="punctuation separator key-value"><span>:</span></span></span><span> </span><span class="constant language boolean true"><span>true</span></span><span>  </span><span class="comment line double-slash"><span class="punctuation definition comment"><span>//</span></span><span> true 为视频+语音通讯，false 为仅语音通讯</span></span></span></span></span></span></span></div><div class="line"><span class="source"><span class="meta"><span><span class="meta"><span class="punctuation definition block"><span>}</span></span></span><span class="meta brace round"><span>)</span></span></span></span><span class="punctuation terminator statement"><span>;</span></span></span></div></pre></div>
<h3><a id="user-content-第三步：用户登录、加入房间、初始化本地媒体（本地摄像头和麦克风）" class="anchor" href="#第三步：用户登录、加入房间、初始化本地媒体（本地摄像头和麦克风）" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>第三步：用户登录、加入房间、初始化本地媒体（本地摄像头和麦克风）</h3>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 登录</span></span></span></div><div class="line"><span class="source js"><span class="variable other object js"><span>rtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>login</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[用户名]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[密码]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div><div class="line"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 加入房间，会自动等待登录成功再加入房间</span></span></span></div><div class="line"><span class="source js"><span class="variable other object js"><span>rtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>joinRoom</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[房间号]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div><div class="line"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 初始化本地媒体，然后把本地媒体放入 &lt;video&gt;（或 &lt;audio&gt;）</span></span></span></div><div class="line"><span class="source js"><span class="variable other object js"><span>rtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>startLocalMedia</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="punctuation definition end round js"><span>)</span></span></span><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>then</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="meta function js"><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable function js"><span>stream</span></span><span class="punctuation definition end round js"><span>)</span></span></span><span> </span><span class="storage type function js"><span>=&gt;</span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="support variable dom js"><span>document</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function dom js"><span>getElementById</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[&lt;video&gt; 标签的 id]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="meta delimiter period js"><span>.</span></span><span class="variable other js"><span>srcObject</span></span><span> </span><span class="keyword operator assignment js"><span>=</span></span><span> stream</span><span class="punctuation terminator statement js"><span>;</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p>更多控制 API 请参看下文的 API 文档，亦可以参看示例代码。</p>
<h3><a id="user-content-第四步：监听事件，播放其他用户传来的视频和语音" class="anchor" href="#第四步：监听事件，播放其他用户传来的视频和语音" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>第四步：监听事件，播放其他用户传来的视频和语音</h3>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 当房间有人加入，或者当你自己刚刚加入了房间</span></span></span></div><div class="line"><span class="source js"><span class="variable other object js"><span>rtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>on</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>room.update:[房间号]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="meta function js"><span class="storage type function js"><span>function</span></span><span> </span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable function js"><span>roomId</span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="variable function js"><span>memberIdList</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> memberIdList 为用户ID数组</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="variable other object js"><span>memberIdList</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function dom js"><span>forEach</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="meta function js"><span class="storage type function js"><span>function</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable function js"><span>memberId</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span>        </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 监听该位用户的媒体流(stream)变化，若有变则用 &lt;video&gt; （或 &lt;audio&gt;）播放该流</span></span></span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span>        </span><span class="variable other object js"><span>rtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>on</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>user.update-stream:</span><span class="punctuation definition string end js"><span>'</span></span></span><span> </span><span class="keyword operator js"><span>+</span></span><span> memberId</span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="meta function js"><span class="storage type function js"><span>function</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable function js"><span>mId</span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="variable function js"><span>stream</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span>            </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 此处省略为该用户新建 &lt;video&gt; 标签的代码</span></span></span></span></span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span>            </span><span class="support variable dom js"><span>document</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function dom js"><span>getElementById</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>[用户 mId 所属 &lt;video&gt; 标签的 id]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="meta delimiter period js"><span>.</span></span><span class="variable other js"><span>srcObject</span></span><span> </span><span class="keyword operator assignment js"><span>=</span></span><span> stream</span><span class="punctuation terminator statement js"><span>;</span></span></span></span></span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span>        </span><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="meta js"><span class="meta js"><span>    </span><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div><div class="line"><span class="source js"><span> </span></span></div><div class="line"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 当房间有人退出</span></span></span></div><div class="line"><span class="source js"><span class="variable other object js"><span>rtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>on</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>room.member-leave:[房间号]</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="meta function js"><span class="storage type function js"><span>function</span></span><span> </span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable function js"><span>roomId</span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="variable function js"><span>memberId</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> memberId 为离开房间的用户ID</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 此处省略删除该用户所属的 &lt;video&gt; 标签的代码</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p>本 SDK 含有丰富的事件，并支持“*”通配符来描述一组事件名称。更多事件请参看下文的 API 文档，亦可以参看示例代码。</p>
<h2><a id="user-content-事件机制" class="anchor" href="#事件机制" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>事件机制</h2>
<p>本 SDK 提供丰富的事件接口，方便满足不同的需求。同时本 SDK 支持后缀通配符“*”以匹配多种事件。</p>
<p>以上文提及的<strong>成员媒体流更新</strong>事件 <code>user.update-stream:[成员ID]</code> 为例，假设需要监听的成员ID名称为 <code>zhang3</code>，那么事件名称就是 <code>user.update-stream:zhang3</code>。我们可以使用 <code>on</code> 接口监听这个事件：</p>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="variable other object js"><span>ymrtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>on</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>user.update-stream:zhang3</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="meta function js"><span class="storage type function js"><span>function</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable function js"><span>memberId</span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="variable function js"><span>stream</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="entity name type object console js"><span>console</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function console js"><span>log</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span>memberId</span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span><span> </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> &quot;zhang3&quot;</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="entity name type object console js"><span>console</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function console js"><span>log</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span>stream</span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span><span>   </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> [Object]</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p>事件名称支持后缀通配符“*”。假设你需要监听所有成员的媒体流更新，可以这么写：</p>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="variable other object js"><span>ymrtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>on</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>user.update-stream:*</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="meta function js"><span class="storage type function js"><span>function</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable function js"><span>eventFullName</span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="variable function js"><span>memberId</span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="variable function js"><span>stream</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="entity name type object console js"><span>console</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function console js"><span>log</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span>eventFullName</span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span><span> </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> &quot;user.update-stream:zhang3&quot;</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="entity name type object console js"><span>console</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function console js"><span>log</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span>memberId</span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span><span> </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> &quot;zhang3&quot;</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="entity name type object console js"><span>console</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function console js"><span>log</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span>stream</span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span><span>   </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> [Object]</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p>如上述代码所示，若使用了通配符，那么回调函数中<strong>第一个参数将会传入这个事件的完整名称</strong>。从第二个参数开始才是事件参数。</p>
<p>如果需要监听所有事件，也可以这么写：</p>
<div class="highlight javascript"><pre class="editor editor-colors"><div class="line"><span class="source js"><span class="variable other object js"><span>ymrtc</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="entity name function js"><span>on</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>*</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta delimiter object comma js"><span>,</span></span><span> </span><span class="meta function js"><span class="storage type function js"><span>function</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable function js"><span>eventFullName</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span> </span><span class="punctuation definition function begin curly js"><span>{</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="entity name type object console js"><span>console</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function console js"><span>log</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span>eventFullName</span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span><span> </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> 事件完整名称，例如 &quot;user.update-stream:zhang3&quot;</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span>    </span><span class="entity name type object console js"><span>console</span></span><span class="meta js"><span class="meta delimiter method period js"><span>.</span></span><span class="support function console js"><span>log</span></span><span class="meta js"><span class="punctuation definition begin round js"><span>(</span></span><span class="variable language js"><span>arguments</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span><span>  </span><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span> Array [事件完整名称, 事件参数1, 事件参数2, ...]</span></span></span></span></span></div><div class="line"><span class="source js"><span class="meta js"><span class="meta js"><span class="punctuation definition function end curly js"><span>}</span></span><span class="punctuation definition end round js"><span>)</span></span></span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre></div>
<p><strong>注：事件名称仅支持把通配符放在最后。</strong> 例如 <code>user.*:zhang3</code> 是不能识别的。</p>
<p>本 SDK 在事件名称的设计上多数采用了 <code>[事件分类].[事件名称]:[某个重要参数]</code> 的格式，以方便后缀通配符的使用。</p>
<h1><a id="user-content-api-文档" class="anchor" href="#api-文档" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>API 文档</h1>
<p>以下是完整的 API 文档。</p>
<p><a name="YMRTC"></a></p>
<h2><a id="user-content-ymrtc" class="anchor" href="#ymrtc" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>YMRTC</h2>
<p>RTC 类</p>
<p><strong>类型</strong>: 全局类(class)</p>
<ul>
<li><a href="#YMRTC" rel="nofollow">YMRTC</a>
<ul>
<li><a href="#new_YMRTC_new" rel="nofollow">new YMRTC(config)</a></li>
<li><em>信令服务器连接</em>
<ul>
<li><a href="#YMRTC+event_signaling.status_%5Bstatus%5D" rel="nofollow">&quot;event:signaling.status:[status]&quot;</a></li>
<li><a href="#YMRTC+event_signaling.ready" rel="nofollow">&quot;event:signaling.ready&quot;</a></li>
</ul>
</li>
<li><em>成员控制</em>
<ul>
<li><a href="#YMRTC+requestUserStream" rel="nofollow">.requestUserStream(userId)</a> ⇒ <code>Promise</code></li>
<li><a href="#YMRTC+getMute" rel="nofollow">.getMute(userId)</a> ⇒ <code>boolean</code></li>
<li><a href="#YMRTC+setMute" rel="nofollow">.setMute(userId, isMuted)</a></li>
<li><a href="#YMRTC+setAllMute" rel="nofollow">.setAllMute(isMuted)</a></li>
<li><a href="#YMRTC+event_user.ice-status_%5BmemberId%5D_%5Bstatus%5D" rel="nofollow">&quot;event:user.ice-status:[memberId]:[status]&quot;</a></li>
<li><a href="#YMRTC+event_user.signaling-status_%5BmemberId%5D_%5Bstatus%5D" rel="nofollow">&quot;event:user.signaling-status:[memberId]:[status]&quot;</a></li>
<li><a href="#YMRTC+event_user.update-stream_%5BmemberId%5D" rel="nofollow">&quot;event:user.update-stream:[memberId]&quot;</a></li>
<li><a href="#YMRTC+event_user.remove-stream_%5BmemberId%5D" rel="nofollow">&quot;event:user.remove-stream:[memberId]&quot;</a></li>
</ul>
</li>
<li><em>房间控制</em>
<ul>
<li><a href="#YMRTC+joinRoom" rel="nofollow">.joinRoom(roomId)</a> ⇒ <code>Promise</code></li>
<li><a href="#YMRTC+leaveRoom" rel="nofollow">.leaveRoom([roomId])</a></li>
<li><a href="#YMRTC+inRoom" rel="nofollow">.inRoom(roomId)</a> ⇒ <code>boolean</code></li>
<li><a href="#YMRTC+getRoomIdList" rel="nofollow">.getRoomIdList()</a> ⇒ <code>Array.&lt;string&gt;</code></li>
<li><a href="#YMRTC+getRoomMemberIdList" rel="nofollow">.getRoomMemberIdList(roomId)</a> ⇒ <code>Array.&lt;string&gt;</code></li>
<li><a href="#YMRTC+event_room.update_%5BroomId%5D" rel="nofollow">&quot;event:room.update:[roomId]&quot;</a></li>
<li><a href="#YMRTC+event_room.member-join_%5BroomId%5D" rel="nofollow">&quot;event:room.member-join:[roomId]&quot;</a></li>
<li><a href="#YMRTC+event_room.member-leave_%5BroomId%5D" rel="nofollow">&quot;event:room.member-leave:[roomId]&quot;</a></li>
<li><a href="#YMRTC+event_room.join_%5BroomId%5D" rel="nofollow">&quot;event:room.join:[roomId]&quot;</a></li>
<li><a href="#YMRTC+event_room.join_%5BroomId%5D" rel="nofollow">&quot;event:room.join:[roomId]&quot;</a></li>
</ul>
</li>
<li><em>本地媒体控制</em>
<ul>
<li><a href="#YMRTC+startLocalMedia" rel="nofollow">.startLocalMedia()</a> ⇒ <code>Promise</code></li>
<li><a href="#YMRTC+pauseLocalMedia" rel="nofollow">.pauseLocalMedia()</a></li>
<li><a href="#YMRTC+pauseLocalVideo" rel="nofollow">.pauseLocalVideo()</a></li>
<li><a href="#YMRTC+pauseLocalAudio" rel="nofollow">.pauseLocalAudio()</a></li>
<li><a href="#YMRTC+resumeLocalMedia" rel="nofollow">.resumeLocalMedia()</a></li>
<li><a href="#YMRTC+resumeLocalVideo" rel="nofollow">.resumeLocalVideo()</a></li>
<li><a href="#YMRTC+resumeLocalAudio" rel="nofollow">.resumeLocalAudio()</a></li>
<li><a href="#YMRTC+isLocalVideoPaused" rel="nofollow">.isLocalVideoPaused()</a> ⇒ <code>boolean</code></li>
<li><a href="#YMRTC+isLocalAudioPaused" rel="nofollow">.isLocalAudioPaused()</a> ⇒ <code>boolean</code></li>
<li><a href="#YMRTC+stopLocalMedia" rel="nofollow">.stopLocalMedia()</a></li>
<li><a href="#YMRTC+getLocalMediaStatus" rel="nofollow">.getLocalMediaStatus()</a> ⇒ <code>string</code></li>
<li><a href="#YMRTC+requestLocalMediaStream" rel="nofollow">.requestLocalMediaStream()</a> ⇒ <code>Promise</code></li>
<li><a href="#YMRTC+event_local-media.status_%5Bstatus%5D" rel="nofollow">&quot;event:local-media.status:[status]&quot;</a></li>
<li><a href="#YMRTC+event_local-media.has-stream" rel="nofollow">&quot;event:local-media.has-stream&quot;</a></li>
<li><a href="#YMRTC+event_local-media.remove-stream" rel="nofollow">&quot;event:local-media.remove-stream&quot;</a></li>
<li><a href="#YMRTC+event_local-media.pause-video" rel="nofollow">&quot;event:local-media.pause-video&quot;</a></li>
<li><a href="#YMRTC+event_local-media.pause-audio" rel="nofollow">&quot;event:local-media.pause-audio&quot;</a></li>
<li><a href="#YMRTC+event_local-media.resume-video" rel="nofollow">&quot;event:local-media.resume-video&quot;</a></li>
<li><a href="#YMRTC+event_local-media.resume-audio" rel="nofollow">&quot;event:local-media.resume-audio&quot;</a></li>
</ul>
</li>
<li><em>用户帐户控制</em>
<ul>
<li><a href="#YMRTC+login" rel="nofollow">.login(userId, token)</a> ⇒ <code>Promise</code></li>
<li><a href="#YMRTC+logout" rel="nofollow">.logout()</a></li>
<li><a href="#YMRTC+getMyUserId" rel="nofollow">.getMyUserId()</a> ⇒ <code>string</code></li>
<li><a href="#YMRTC+event_account.logged" rel="nofollow">&quot;event:account.logged&quot;</a></li>
<li><a href="#YMRTC+event_account.logging" rel="nofollow">&quot;event:account.logging&quot;</a></li>
<li><a href="#YMRTC+event_account.logout" rel="nofollow">&quot;event:account.logout&quot;</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<p><a name="new_YMRTC_new"></a></p>
<h3><a id="user-content-new-ymrtcconfig" class="anchor" href="#new-ymrtcconfig" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>new YMRTC(config)</h3>
<p>新建一个游密 RTC 对象。</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>默认值</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td><code>Object</code></td>
<td></td>
<td>配置</td>
</tr>
<tr>
<td>config.appKey</td>
<td><code>string</code></td>
<td></td>
<td>游密分配的 appKey</td>
</tr>
<tr>
<td>[config.userId]</td>
<td><code>string</code></td>
<td></td>
<td>可选。用户登录 ID，若在此处直接输入用户ID和密码，则初始化后自动登录</td>
</tr>
<tr>
<td>[config.token]</td>
<td><code>string</code></td>
<td></td>
<td>可选。用户登录密码，若在此处直接输入用户ID和密码，则初始化后自动登录</td>
</tr>
<tr>
<td>[config.roomId]</td>
<td><code>string</code></td>
<td></td>
<td>可选。要加入的房间ID，若输入此值，则初始化并登录（自动或手动登录均可）之后自动加入房间</td>
</tr>
<tr>
<td>[config.video]</td>
<td><code>boolean</code></td>
<td><code>true</code></td>
<td>是否为视频聊天，若为 <code>false</code> 则为仅语音聊天</td>
</tr>
<tr>
<td>[config.localMediaConstraints]</td>
<td><code>MediaStreamConstraints</code></td>
<td></td>
<td>可选。自定义本地媒体的配置，配置项可参看 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints" rel="nofollow">mdn 文档</a></td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_signaling.status_[status]"></a></p>
<h3><a id="user-content-eventsignalingstatusstatus" class="anchor" href="#eventsignalingstatusstatus" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:signaling.status:[status]&quot;</h3>
<p>信令连接状态改变。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 信令服务器连接<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>status</td>
<td><code>string</code></td>
<td>新的状态值，状态的取值：<br />  - <code>disconnected</code>: 未连接；<br />  - <code>connecting</code>: 正在尝试连接；<br />  - <code>connected</code>: 已连接；<br />  - <code>reconnecting</code>: （掉线后）重新连接；<br />  - <code>ended</code>: 用户主动结束了连接。<br /></td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_signaling.ready"></a></p>
<h3><a id="user-content-eventsignalingready" class="anchor" href="#eventsignalingready" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:signaling.ready&quot;</h3>
<p>信令服务器已经成功连接，等同于事件 <code>signaling.status:connected</code></p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 信令服务器连接<br />
<a name="YMRTC+requestUserStream"></a></p>
<h3><a id="user-content-ymrtcrequestuserstreamuserid-⇒-promise" class="anchor" href="#ymrtcrequestuserstreamuserid-⇒-promise" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.requestUserStream(userId) ⇒ <code>Promise</code></h3>
<p>异步请求一个成员的媒体流（stream）。若未与此成员建立连接，
则等待连接完成，否则直接回调已存在的媒体流。
<strong>注意</strong>：中途媒体流对象可能会发生改变，请监听
“<code>user.update-stream</code>”事件以对界面做出相应的改变。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 成员控制<br />
<strong>完成回调</strong>: <code>MediaStream</code> - 得到的媒体流对象，
赋值给 <code>&lt;video&gt;</code> 或 <code>&lt;audio&gt;</code> 的 <code>srcObject</code> 属性即可播放。
关于此对象的更多资料，可参阅 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaStream" rel="nofollow">mdn 文档</a><br />
<strong>拒绝回调</strong>: <code>void</code> - 由于会一直等待媒体流，因此暂时未设定请求失败的情况</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td><code>string</code></td>
<td>成员ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+getMute"></a></p>
<h3><a id="user-content-ymrtcgetmuteuserid-⇒-boolean" class="anchor" href="#ymrtcgetmuteuserid-⇒-boolean" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.getMute(userId) ⇒ <code>boolean</code></h3>
<p>获取一个成员的静音状态。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>返回值</strong>: <code>boolean</code> - 是否静音<br />
<strong>分类</strong>: 成员控制</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td><code>string</code></td>
<td>成员ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+setMute"></a></p>
<h3><a id="user-content-ymrtcsetmuteuserid-ismuted" class="anchor" href="#ymrtcsetmuteuserid-ismuted" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.setMute(userId, isMuted)</h3>
<p>为一个成员的音频流设置静音。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 成员控制</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td><code>string</code></td>
<td>成员ID</td>
</tr>
<tr>
<td>isMuted</td>
<td><code>boolean</code></td>
<td>是否静音</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+setAllMute"></a></p>
<h3><a id="user-content-ymrtcsetallmuteismuted" class="anchor" href="#ymrtcsetallmuteismuted" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.setAllMute(isMuted)</h3>
<p>为所有成员的音频流设置静音。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 成员控制</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>isMuted</td>
<td><code>boolean</code></td>
<td>是否静音</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_user.ice-status_[memberId]_[status]"></a></p>
<h3><a id="user-content-eventuserice-statusmemberidstatus" class="anchor" href="#eventuserice-statusmemberidstatus" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:user.ice-status:[memberId]:[status]&quot;</h3>
<p>原生 ICE (RTC.iceConnectionState) 状态有改变，
可参阅 <a href="https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState" rel="nofollow">mdn 文档</a></p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 成员控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>memberId</td>
<td><code>string</code></td>
<td>状态有改变的成员ID</td>
</tr>
<tr>
<td>status</td>
<td><code>string</code></td>
<td>新状态，状态的取值请参阅 <a href="https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState" rel="nofollow">mdn 文档</a></td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_user.signaling-status_[memberId]_[status]"></a></p>
<h3><a id="user-content-eventusersignaling-statusmemberidstatus" class="anchor" href="#eventusersignaling-statusmemberidstatus" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:user.signaling-status:[memberId]:[status]&quot;</h3>
<p>与成员之间的连接协商状态有改变。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 成员控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>memberId</td>
<td><code>string</code></td>
<td>状态有改变的成员ID</td>
</tr>
<tr>
<td>status</td>
<td><code>string</code></td>
<td>新状态，状态的取值: <br />  - <code>new</code>: 未连接；<br />  - <code>waiting</code>: 等待对方连接过来；<br />  - <code>negotiating</code>: 正在协商（交换视频格式信息等等）；<br />  - <code>negotiated</code>: 协商完成（成功）；<br />  - <code>failed</code>: 连接失败。<br /></td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_user.update-stream_[memberId]"></a></p>
<h3><a id="user-content-eventuserupdate-streammemberid" class="anchor" href="#eventuserupdate-streammemberid" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:user.update-stream:[memberId]&quot;</h3>
<p>成员的媒体流有改变，这时需要更新对应成员的 <code>&lt;video&gt;</code> 或 <code>&lt;audio&gt;</code> 的 srcObject 属性。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 成员控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>memberId</td>
<td><code>string</code></td>
<td>有改变的成员ID</td>
</tr>
<tr>
<td>stream</td>
<td><code>MediaStream</code></td>
<td>新的媒体流，把此值赋值给 <code>&lt;video&gt;</code> 或 <code>&lt;audio&gt;</code> 的 srcObject 属性即可更新媒体流。</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_user.remove-stream_[memberId]"></a></p>
<h3><a id="user-content-eventuserremove-streammemberid" class="anchor" href="#eventuserremove-streammemberid" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:user.remove-stream:[memberId]&quot;</h3>
<p>成员的媒体流被对方移除，这时对应成员的 <code>&lt;video&gt;</code> 或 <code>&lt;audio&gt;</code> 的视频或音频播放可能会突然定格或停止，忽略它而不做处理并无大碍，此事件用于防备不时之需。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 成员控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>memberId</td>
<td><code>string</code></td>
<td>有改变的成员ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+joinRoom"></a></p>
<h3><a id="user-content-ymrtcjoinroomroomid-⇒-promise" class="anchor" href="#ymrtcjoinroomroomid-⇒-promise" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.joinRoom(roomId) ⇒ <code>Promise</code></h3>
<p>加入房间，会自动等待登录成功以及本地媒体初始化完成再加入房间。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 房间控制<br />
<strong>完成回调</strong>: <code>void</code> - 加入房间成功<br />
<strong>拒绝回调</strong>: <code>void</code> - 由于自动等待登录和本地媒体，因此暂时没有定义失败的情况</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>roomId</td>
<td><code>string</code></td>
<td>房间ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+leaveRoom"></a></p>
<h3><a id="user-content-ymrtcleaveroomroomid" class="anchor" href="#ymrtcleaveroomroomid" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.leaveRoom([roomId])</h3>
<p>退出房间，并断开房间内成员之间的连接。强制退出，无返回值。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 房间控制</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>[roomId]</td>
<td><code>string</code></td>
<td>可选。指定要退出的房间ID，若不指定则退出所有房间</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+inRoom"></a></p>
<h3><a id="user-content-ymrtcinroomroomid-⇒-boolean" class="anchor" href="#ymrtcinroomroomid-⇒-boolean" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.inRoom(roomId) ⇒ <code>boolean</code></h3>
<p>返回目前是否正在某个房间之内。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>返回值</strong>: <code>boolean</code> - - 是否在房间内<br />
<strong>分类</strong>: 房间控制</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>roomId</td>
<td><code>string</code></td>
<td>房间ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+getRoomIdList"></a></p>
<h3><a id="user-content-ymrtcgetroomidlist-⇒-arraystring" class="anchor" href="#ymrtcgetroomidlist-⇒-arraystring" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.getRoomIdList() ⇒ <code>Array.&lt;string&gt;</code></h3>
<p>返回当前已经加入的房间ID列表。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>返回值</strong>: <code>Array.&lt;string&gt;</code> - - 房间ID数组<br />
<strong>分类</strong>: 房间控制<br />
<a name="YMRTC+getRoomMemberIdList"></a></p>
<h3><a id="user-content-ymrtcgetroommemberidlistroomid-⇒-arraystring" class="anchor" href="#ymrtcgetroommemberidlistroomid-⇒-arraystring" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.getRoomMemberIdList(roomId) ⇒ <code>Array.&lt;string&gt;</code></h3>
<p>返回房间内所有成员的ID列表。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>返回值</strong>: <code>Array.&lt;string&gt;</code> - - 成员ID数组<br />
<strong>分类</strong>: 房间控制</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>roomId</td>
<td><code>string</code></td>
<td>房间ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_room.update_[roomId]"></a></p>
<h3><a id="user-content-eventroomupdateroomid" class="anchor" href="#eventroomupdateroomid" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:room.update:[roomId]&quot;</h3>
<p>房间[roomId]中的成员有更新（有人加入或者离开）。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 房间控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>roomId</td>
<td><code>string</code></td>
<td>房间ID</td>
</tr>
<tr>
<td>members</td>
<td><code>Array.&lt;string&gt;</code></td>
<td>房间内所有成员的ID列表</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_room.member-join_[roomId]"></a></p>
<h3><a id="user-content-eventroommember-joinroomid" class="anchor" href="#eventroommember-joinroomid" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:room.member-join:[roomId]&quot;</h3>
<p>一位成员加入了房间[roomId]。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 房间控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>roomId</td>
<td><code>string</code></td>
<td>房间ID</td>
</tr>
<tr>
<td>member</td>
<td><code>string</code></td>
<td>加入房间的成员ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_room.member-leave_[roomId]"></a></p>
<h3><a id="user-content-eventroommember-leaveroomid" class="anchor" href="#eventroommember-leaveroomid" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:room.member-leave:[roomId]&quot;</h3>
<p>一位成员离开了房间[roomId]。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 房间控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>roomId</td>
<td><code>string</code></td>
<td>房间ID</td>
</tr>
<tr>
<td>member</td>
<td><code>string</code></td>
<td>离开房间的成员ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_room.join_[roomId]"></a></p>
<h3><a id="user-content-eventroomjoinroomid" class="anchor" href="#eventroomjoinroomid" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:room.join:[roomId]&quot;</h3>
<p>本帐户进入了房间[roomId]。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 房间控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>roomId</td>
<td><code>string</code></td>
<td>房间ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_room.join_[roomId]"></a></p>
<h3><a id="user-content-eventroomjoinroomid-1" class="anchor" href="#eventroomjoinroomid-1" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:room.join:[roomId]&quot;</h3>
<p>本帐户离开了房间[roomId]。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 房间控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>roomId</td>
<td><code>string</code></td>
<td>房间ID</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+startLocalMedia"></a></p>
<h3><a id="user-content-ymrtcstartlocalmedia-⇒-promise" class="anchor" href="#ymrtcstartlocalmedia-⇒-promise" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.startLocalMedia() ⇒ <code>Promise</code></h3>
<p>启动本地媒体。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<strong>完成回调</strong>: <code>MediaStream</code> - 启动成功，获得本地媒体流对象，
赋值给 <code>&lt;video&gt;</code> 或 <code>&lt;audio&gt;</code> 的 <code>srcObject</code> 属性即可播放。
关于此对象的更多资料，可参阅 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaStream" rel="nofollow">mdn 文档</a><br />
<strong>拒绝回调</strong>: <code>DOMException</code> - 启动失败，获得原生的错误对象。
具体错误可参见 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Return_value" rel="nofollow">mdn 文档</a>。<br />
<a name="YMRTC+pauseLocalMedia"></a></p>
<h3><a id="user-content-ymrtcpauselocalmedia" class="anchor" href="#ymrtcpauselocalmedia" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.pauseLocalMedia()</h3>
<p>暂停本地媒体（屏蔽摄像头、关闭麦克风）。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+pauseLocalVideo"></a></p>
<h3><a id="user-content-ymrtcpauselocalvideo" class="anchor" href="#ymrtcpauselocalvideo" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.pauseLocalVideo()</h3>
<p>暂停本地视频（只屏蔽摄像头，麦克风不变）。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+pauseLocalAudio"></a></p>
<h3><a id="user-content-ymrtcpauselocalaudio" class="anchor" href="#ymrtcpauselocalaudio" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.pauseLocalAudio()</h3>
<p>暂停本地视频（只屏蔽麦克风，摄像头不变）。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+resumeLocalMedia"></a></p>
<h3><a id="user-content-ymrtcresumelocalmedia" class="anchor" href="#ymrtcresumelocalmedia" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.resumeLocalMedia()</h3>
<p>恢复本地媒体（取消屏蔽摄像头、取消关闭麦克风）。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+resumeLocalVideo"></a></p>
<h3><a id="user-content-ymrtcresumelocalvideo" class="anchor" href="#ymrtcresumelocalvideo" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.resumeLocalVideo()</h3>
<p>恢复本地视频（只取消屏蔽摄像头、麦克风不变）。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+resumeLocalAudio"></a></p>
<h3><a id="user-content-ymrtcresumelocalaudio" class="anchor" href="#ymrtcresumelocalaudio" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.resumeLocalAudio()</h3>
<p>恢复本地音频（只取消屏蔽麦克风、摄像头不变）。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+isLocalVideoPaused"></a></p>
<h3><a id="user-content-ymrtcislocalvideopaused-⇒-boolean" class="anchor" href="#ymrtcislocalvideopaused-⇒-boolean" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.isLocalVideoPaused() ⇒ <code>boolean</code></h3>
<p>返回摄像头是否为屏蔽状态。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>返回值</strong>: <code>boolean</code> - - true: 屏蔽了，false: 没屏蔽<br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+isLocalAudioPaused"></a></p>
<h3><a id="user-content-ymrtcislocalaudiopaused-⇒-boolean" class="anchor" href="#ymrtcislocalaudiopaused-⇒-boolean" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.isLocalAudioPaused() ⇒ <code>boolean</code></h3>
<p>返回麦克风是否为屏蔽状态。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>返回值</strong>: <code>boolean</code> - - true: 屏蔽了，false: 没屏蔽<br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+stopLocalMedia"></a></p>
<h3><a id="user-content-ymrtcstoplocalmedia" class="anchor" href="#ymrtcstoplocalmedia" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.stopLocalMedia()</h3>
<p>停止本地媒体（关掉摄像头和麦克风的电源）。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+getLocalMediaStatus"></a></p>
<h3><a id="user-content-ymrtcgetlocalmediastatus-⇒-string" class="anchor" href="#ymrtcgetlocalmediastatus-⇒-string" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.getLocalMediaStatus() ⇒ <code>string</code></h3>
<p>获取本地媒体的当前状态。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>返回值</strong>: <code>string</code> - - <code>stop</code>: 未启动，<br /><code>starting</code>: 正在尝试启动，
<code>recording</code>: 已经启动，正在录音和/或录像，<code>failed</code>: 启动失败<br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+requestLocalMediaStream"></a></p>
<h3><a id="user-content-ymrtcrequestlocalmediastream-⇒-promise" class="anchor" href="#ymrtcrequestlocalmediastream-⇒-promise" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.requestLocalMediaStream() ⇒ <code>Promise</code></h3>
<p>异步请求本地媒体流 (stream)。若本地媒体尚未启动，
则等待启动成功，否则直接回调已存在的媒体流。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 本地媒体控制<br />
<strong>完成回调</strong>: <code>MediaStream</code> - 获得本地媒体流
赋值给 <code>&lt;video&gt;</code> 或 <code>&lt;audio&gt;</code> 的 <code>srcObject</code> 属性即可播放。
关于此对象的更多资料，可参阅 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaStream" rel="nofollow">mdn 文档</a><br />
<strong>拒绝回调</strong>: <code>DOMException</code> - 启动失败，获得原生的错误对象。<br />
<a name="YMRTC+event_local-media.status_[status]"></a></p>
<h3><a id="user-content-eventlocal-mediastatusstatus" class="anchor" href="#eventlocal-mediastatusstatus" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:local-media.status:[status]&quot;</h3>
<p>本地媒体状态改变。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 本地媒体控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>status</td>
<td><code>string</code></td>
<td>新的状态值，状态的取值：<br />  - <code>stop</code>: 本地媒体已经停止（摄像头和麦克风都已经关掉了）；<br />  - <code>starting</code>: 正在尝试启动本地媒体（包括请求权限和初始化设备）；<br />  - <code>recording</code>: 本地媒体已经成功启动，正在录像和/或录音；<br />  - <code>failed</code>: 失败（可能设备出错，或者用户禁止了摄像头和麦克风权限）。<br /></td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_local-media.has-stream"></a></p>
<h3><a id="user-content-eventlocal-mediahas-stream" class="anchor" href="#eventlocal-mediahas-stream" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:local-media.has-stream&quot;</h3>
<p>本地媒体流已经准备就绪。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 本地媒体控制<br />
<strong>属性</strong></p>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>stream</td>
<td><code>MediaStream</code></td>
<td>本地媒体流对象。</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+event_local-media.remove-stream"></a></p>
<h3><a id="user-content-eventlocal-mediaremove-stream" class="anchor" href="#eventlocal-mediaremove-stream" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:local-media.remove-stream&quot;</h3>
<p>本地媒体流被移除。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+event_local-media.pause-video"></a></p>
<h3><a id="user-content-eventlocal-mediapause-video" class="anchor" href="#eventlocal-mediapause-video" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:local-media.pause-video&quot;</h3>
<p>本地媒体视频暂停（屏蔽了摄像头，对方只能看到黑屏）。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+event_local-media.pause-audio"></a></p>
<h3><a id="user-content-eventlocal-mediapause-audio" class="anchor" href="#eventlocal-mediapause-audio" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:local-media.pause-audio&quot;</h3>
<p>本地媒体音频暂停（关闭了麦克风，使对方听不到声音）。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+event_local-media.resume-video"></a></p>
<h3><a id="user-content-eventlocal-mediaresume-video" class="anchor" href="#eventlocal-mediaresume-video" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:local-media.resume-video&quot;</h3>
<p>本地媒体视频恢复（取消暂停状态，摄像头重新亮起来）。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+event_local-media.resume-audio"></a></p>
<h3><a id="user-content-eventlocal-mediaresume-audio" class="anchor" href="#eventlocal-mediaresume-audio" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:local-media.resume-audio&quot;</h3>
<p>本地媒体音频暂停（取消暂停状态，麦克风重新开始采集声音）。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 本地媒体控制<br />
<a name="YMRTC+login"></a></p>
<h3><a id="user-content-ymrtcloginuserid-token-⇒-promise" class="anchor" href="#ymrtcloginuserid-token-⇒-promise" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.login(userId, token) ⇒ <code>Promise</code></h3>
<p>用户登录。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 用户帐户控制<br />
<strong>完成回调</strong>: <code>void</code> - 登录成功<br />
<strong>拒绝回调</strong>: <code>string</code> - 登录失败，回调失败信息</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>userId</td>
<td><code>string</code></td>
<td>用户ID</td>
</tr>
<tr>
<td>token</td>
<td><code>string</code></td>
<td>用户密码</td>
</tr>
</tbody>
</table>
<p><a name="YMRTC+logout"></a></p>
<h3><a id="user-content-ymrtclogout" class="anchor" href="#ymrtclogout" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.logout()</h3>
<p>用户退出登录，断开所有连接。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>分类</strong>: 用户帐户控制<br />
<a name="YMRTC+getMyUserId"></a></p>
<h3><a id="user-content-ymrtcgetmyuserid-⇒-string" class="anchor" href="#ymrtcgetmyuserid-⇒-string" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ymrtc.getMyUserId() ⇒ <code>string</code></h3>
<p>获得当前用户ID。</p>
<p><strong>类型</strong>: 实例方法(method)，来自 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a><br />
<strong>返回值</strong>: <code>string</code> - - 用户ID。若未登录，则返回空字符串 ''。<br />
<strong>分类</strong>: 用户帐户控制<br />
<a name="YMRTC+event_account.logged"></a></p>
<h3><a id="user-content-eventaccountlogged" class="anchor" href="#eventaccountlogged" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:account.logged&quot;</h3>
<p>用户登录成功。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 用户帐户控制<br />
<a name="YMRTC+event_account.logging"></a></p>
<h3><a id="user-content-eventaccountlogging" class="anchor" href="#eventaccountlogging" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:account.logging&quot;</h3>
<p>正在登录。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 用户帐户控制<br />
<a name="YMRTC+event_account.logout"></a></p>
<h3><a id="user-content-eventaccountlogout" class="anchor" href="#eventaccountlogout" aria-hidden="true" rel="nofollow"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>&quot;event:account.logout&quot;</h3>
<p>已登出。</p>
<p><strong>类型</strong>: 事件，由 <a href="#YMRTC" rel="nofollow"><code>YMRTC</code></a> 触发<br />
<strong>分类</strong>: 用户帐户控制</p>

    </article>
</body>
</html>